from rest_framework.serializers import ModelSerializer, SerializerMethodField, DateTimeField
from .models import *


class UserSer(ModelSerializer):
    class Meta:
        model = UserModel
        exclude = ['password']


class StorySer(ModelSerializer):
    class Meta:
        model = StoryModel
        fields = '__all__'


class RecordSer(ModelSerializer):
    user = UserSer()
    story = StorySer()
    start = DateTimeField('%Y-%m-%d %H:%M:%S')
    end = DateTimeField('%Y-%m-%d %H:%M:%S')

    class Meta:
        model = RecordModel
        fields = '__all__'


class NumSer(ModelSerializer):
    user = UserSer()
    story = StorySer()

    class Meta:
        model = NumBer
        fields = '__all__'
